package com.atguigu.config;

import feign.Logger;
import feign.Retryer;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class HttpConfig {

    /*
    * 实现远程接口调用
    * */
    @LoadBalanced
    @Bean
    public  RestTemplate restTemplate() {
        return new RestTemplate();
    }


    /*
    * 远程链接--日志信息
    * */
    @Bean
    Logger.Level feignLoggerLevel(){
        return Logger.Level.FULL;
    }

    /*
    * 重试请求
    * */
    @Bean
    Retryer feignRetryer(){
        return new Retryer.Default();
    }
}
